<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Loading Text Animation</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
</head>
<body>
<div id="shimmerWave">Grab a snack, this might take a while...</div>
<script>
const target = document.getElementById("shimmerWave");
function splitTextToSpans(targetElement) {
if (targetElement) {
const text = targetElement.textContent;
targetElement.innerHTML = "";
for (let character of text) {
const span = document.createElement("span");
if (character === " ") {
span.innerHTML = " ";
} else {
span.textContent = character;
}
targetElement.appendChild(span);
}
}
}
splitTextToSpans(target);
</script>
</body>
</html>